let types = require('../constants');

// target.key {scope} value
class Assign {
  constructor(target, scope, key, value) {
    this.type = types.COMMAND_TYPE.ASSIGN;
    this.target = target;
    this.scope = scope;
    this.key = key;
    this.value = value;
  }
}

// source.port -> target
class Connect {
  constructor(source, sport, target, tport) {
    this.type = types.COMMAND_TYPE.CONNECT;
    this.source = source;
    this.sport = sport;
    this.target = target;
    this.tport = tport;
  }
}

// source -> uri pos
class Create {
  constructor(uri, source, sport, pos) {
    this.type = types.COMMAND_TYPE.CREATE;
    this.uri = uri;
    this.source = source;
    this.sport = sport;
    this.pos = pos;
  }
}

// target.scope
class Show {
  constructor(target, scope, key) {
    this.type = 'show';
    this.target = target;
    this.scope = scope;
    this.key = key;
  }
}

// rm target
class RmNode {
  constructor(target) {
    this.type = types.COMMAND_TYPE.RMNODE;
    this.target = target;
  }
}

// rm target.port
class RmEdge {
  constructor(target, port) {
    this.type = types.COMMAND_TYPE.RMEDGE;
    this.target = target;
    this.port = port;
  }
}

// clone target pos
class Clone {
  constructor(target, pos) {
    this.type = types.COMMAND_TYPE.CLONE;
    this.target = target;
    this.pos = pos;
  }
}

// type{force}ref
class Pos {
  constructor(type, ref, force) {
    this.type = type;
    this.ref = ref;
    this.force = force;
  }
}

// save ls
class GraphUnary {
  constructor(type) {
    this.type = type;
  }
}

// cls help
class ModuleUnary {
  constructor(type) {
    this.type = type;
  }
}

module.exports = {
  Assign,
  Connect,
  Create,
  Show,
  Pos,
  RmNode,
  RmEdge,
  Clone,
  GraphUnary,
  ModuleUnary
};
